home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / Interfaces&Libraries / Universal / Interfaces / AIncludes / NumberFormatting.a < prev    next >
Encoding:
Text File  |  1998-08-17  |  4.5 KB  |  183 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        NumberFormatting.a
  3. ;
  4. ;    Contains:    Utilites for formatting numbers
  5. ;
  6. ;    Version:    Technology:    
  7. ;                Release:    Universal Interfaces 3.2
  8. ;
  9. ;    Copyright:    © 1996-1998 by Apple Computer, Inc., all rights reserved.
  10. ;
  11. ;    Bugs?:        For bug reports, consult the following page on
  12. ;                the World Wide Web:
  13. ;
  14. ;                    http://developer.apple.com/bugreporter/
  15. ;
  16. ;
  17.     IF &TYPE('__NUMBERFORMATTING__') = 'UNDEFINED' THEN
  18. __NUMBERFORMATTING__ SET 1
  19.  
  20.     IF &TYPE('__CONDITIONALMACROS__') = 'UNDEFINED' THEN
  21.     include 'ConditionalMacros.a'
  22.     ENDIF
  23.     IF &TYPE('__MACTYPES__') = 'UNDEFINED' THEN
  24.     include 'MacTypes.a'
  25.     ENDIF
  26.     IF &TYPE('__INTLRESOURCES__') = 'UNDEFINED' THEN
  27.     include 'IntlResources.a'
  28.     ENDIF
  29.  
  30.  
  31. ;
  32. ;    Here are the current System 7 routine names and the translations to the older forms.
  33. ;    Please use the newer forms in all new code and migrate the older names out of existing
  34. ;    code as maintainance permits.
  35. ;    
  36. ;    New Name                    Old Name(s)
  37. ;    
  38. ;    ExtendedToString            FormatX2Str
  39. ;    FormatRecToString            Format2Str
  40. ;    NumToString                
  41. ;    StringToExtended            FormatStr2X
  42. ;    StringToFormatRec            Str2Format
  43. ;    StringToNum                
  44. ;
  45. ;
  46.  
  47. NumFormatString            RECORD 0
  48. fLength                     ds.b    1                ; offset: $0 (0)
  49. fVersion                 ds.b    1                ; offset: $1 (1)
  50. data                     ds.b    254                ; offset: $2 (2)        ;  private data 
  51. sizeof                     EQU *                    ; size:   $100 (256)
  52.                         ENDR
  53. NumFormatStringRec        RECORD 0
  54. f                         ds        NumFormatString
  55. sizeof                     EQU *                    ; size:   $100 (256)
  56.                         ENDR
  57.  
  58.  
  59. ; typedef short                         FormatStatus
  60.  
  61.  
  62. fVNumber                        EQU        0                    ; first version of NumFormatString 
  63. ; typedef SInt8                         FormatClass
  64.  
  65.  
  66. fPositive                        EQU        0
  67. fNegative                        EQU        1
  68. fZero                            EQU        2
  69. ; typedef SInt8                         FormatResultType
  70.  
  71.  
  72. fFormatOK                        EQU        0
  73. fBestGuess                        EQU        1
  74. fOutOfSynch                        EQU        2
  75. fSpuriousChars                    EQU        3
  76. fMissingDelimiter                EQU        4
  77. fExtraDecimal                    EQU        5
  78. fMissingLiteral                    EQU        6
  79. fExtraExp                        EQU        7
  80. fFormatOverflow                    EQU        8
  81. fFormStrIsNAN                    EQU        9
  82. fBadPartsTable                    EQU        10
  83. fExtraPercent                    EQU        11
  84. fExtraSeparator                    EQU        12
  85. fEmptyFormatString                EQU        13
  86. FVector                    RECORD 0
  87. start                     ds.w    1                ; offset: $0 (0)
  88. length                     ds.w    1                ; offset: $2 (2)
  89. sizeof                     EQU *                    ; size:   $4 (4)
  90.                         ENDR
  91. ;  index by [fPositive..fZero] 
  92. TripleInt                RECORD 0
  93. elements                 ds.b    3 * FVector.sizeof
  94. sizeof                     EQU *                    ; size:   $C (12)
  95.                         ENDR
  96.  
  97.  
  98. ;
  99. ; pascal void StringToNum(ConstStr255Param theString, long *theNum)
  100. ;
  101.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  102.         Macro
  103.         _StringToNum
  104.             move.w              #$0001,-(sp)
  105.             dc.w                $A9EE
  106.         EndM
  107.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  108.         IMPORT_CFM_FUNCTION StringToNum
  109.     ENDIF
  110.  
  111. ;
  112. ; pascal void NumToString(long theNum, Str255 theString)
  113. ;
  114.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  115.         Macro
  116.         _NumToString
  117.             move.w              #$0000,-(sp)
  118.             dc.w                $A9EE
  119.         EndM
  120.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  121.         IMPORT_CFM_FUNCTION NumToString
  122.     ENDIF
  123.  
  124.  
  125. ;
  126. ; pascal FormatStatus ExtendedToString(const extended80 *x, const NumFormatString *myCanonical, const NumberParts *partsTable, Str255 outString)
  127. ;
  128.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  129.         Macro
  130.         _ExtendedToString
  131.             move.l              #$8210FFE8,-(sp)
  132.             dc.w                $A8B5
  133.         EndM
  134.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  135.         IMPORT_CFM_FUNCTION ExtendedToString
  136.     ENDIF
  137.  
  138. ;
  139. ; pascal FormatStatus StringToExtended(ConstStr255Param source, const NumFormatString *myCanonical, const NumberParts *partsTable, extended80 *x)
  140. ;
  141.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  142.         Macro
  143.         _StringToExtended
  144.             move.l              #$8210FFE6,-(sp)
  145.             dc.w                $A8B5
  146.         EndM
  147.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  148.         IMPORT_CFM_FUNCTION StringToExtended
  149.     ENDIF
  150.  
  151. ;
  152. ; pascal FormatStatus StringToFormatRec(ConstStr255Param inString, const NumberParts *partsTable, NumFormatString *outString)
  153. ;
  154.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  155.         Macro
  156.         _StringToFormatRec
  157.             move.l              #$820CFFEC,-(sp)
  158.             dc.w                $A8B5
  159.         EndM
  160.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  161.         IMPORT_CFM_FUNCTION StringToFormatRec
  162.     ENDIF
  163.  
  164. ;
  165. ; pascal FormatStatus FormatRecToString(const NumFormatString *myCanonical, const NumberParts *partsTable, Str255 outString, TripleInt positions)
  166. ;
  167.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  168.         Macro
  169.         _FormatRecToString
  170.             move.l              #$8210FFEA,-(sp)
  171.             dc.w                $A8B5
  172.         EndM
  173.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  174.         IMPORT_CFM_FUNCTION FormatRecToString
  175.     ENDIF
  176.  
  177.  
  178.     IF OLDROUTINENAMES THEN
  179.     ENDIF    ; OLDROUTINENAMES
  180.     ENDIF ; __NUMBERFORMATTING__ 
  181.  
  182.